﻿@using TomNet.IMSC.Model.DbModels.Finance
@using TomNet.IMSC.Web.Areas.Finance.Controllers;
@using TomNet.IMSC.Web.Areas.Finance.Models;

@{
    var entity = ViewData["entity"] as FinanceRunnings;
    var loan = ViewData["attEntity"] as FinanceTransferRunnings;
    var exp = ViewData["expEntity"] as FinanceRunningsExpandTime;

    var imgList = ViewData["images"] as List<BaseName>;
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <link href="~/Content/Css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css?v=4.1.0" rel="stylesheet">
    <link href="~/Content/Css/plugins/steps/jquery.steps.css" rel="stylesheet" />
    <link href="~/Content/common.css" rel="stylesheet">

    @*<script src="~/Scripts/plugins/pace/pace.min.js"></script>*@
    <link href="~/Areas/Finance/Scripts/RunningEdit.css?@(DateTime.Now.Ticks)" rel="stylesheet" />
    @*<style>
            .ibox {
                margin-bottom: 0px;
            }

            .ibox-content {
                padding: 15px 20px 0px 20px;
            }

            fieldset {
                padding: .35em .625em .75em;
                margin: 0 0px;
                border: 1px solid silver;
            }

            legend {
                padding: .5em;
                border: 0;
                width: auto;
            }
            #div1 {
                width: 85px;
                height: 28px;
                border-radius: 12px;
                position: relative;
            }

            #div2 {
                width: 48px;
                height: 24px;
                border-radius: 10px;
                position: absolute;
                background: white;
                box-shadow: 0px 2px 4px rgba(0,0,0,0.4);
            }

            .open1 {
                background: rgba(0,184,0,0.8);
            }

            .open2 {
                top: 2px;
                right: 1px;
                text-align: center;
                line-height: 25px;
                vertical-align: middle;
                color: red;
            }

            .close1 {
                background: rgba(255,255,255,0.4);
                border: 2px solid rgba(0,0,0,0.15);
                border-left: transparent;
            }

            .close2 {
                left: 0px;
                top: 0px;
                border: 1px solid rgba(0,0,0,0.1);
                text-align: center;
                line-height: 25px;
                vertical-align: middle;
                color: green;
            }

            legend {
                padding: .5em;
                border: 0;
                width: auto;
                display: block;
                margin-bottom: 0px;
                padding: 0;
                font-size: 17px;
                line-height: inherit;
                color: #333;
            }


            .form-group {
                margin-bottom: 0px;
                height: 39px;
                min-height: 39px;
            }



            .wizard > .content > .body {
                float: left;
                position: absolute;
                width: 95%;
                height: 95%;
                padding: 0.5%;
            }

            .form-horizontal .control-label {
                padding-top: 0px;
                margin-bottom: 0;
                text-align: right;
            }
            .wizard > .steps > ul > li {
                width: 13%;
            }


            .wizard > .content {
                background: #eee;
                display: block;
                margin: 5px 5px 10px 5px;
                min-height: 240px;
                width: auto;
                -webkit-border-radius: 5px;
                -moz-border-radius: 5px;
                border-radius: 5px;
            }


            .col-sm-12 > .col-xs-3 > .form-group > .col-xs-8 {
                padding-top: 7px;
                margin-bottom: 0;
            }
        </style>*@
</head>
<body>

    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <a class="edit" href="/Finance/Transfer/Index" title="过户流水">过户流水 ->@(entity.IntermediaryName)</a>->>过户业务详情<h5></h5>
                    </div>
                </div>
            </div>
        </div>
        <form class="form-horizontal" id="mainForm">

            <div class="col-sm-6 m-t">
                <fieldset>
                    <legend>门店信息</legend>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">门店：</label>
                        <div class="col-sm-8">
                            <input id="IntermediaryName" name="IntermediaryName" value="@entity.IntermediaryName" readonly type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">联系人：</label>
                        <div class="col-sm-8">
                            <input id="UserName" name="UserName" value="@entity.UserName" readonly type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">电话：</label>
                        <div class="col-sm-8">
                            <input id="UserPhone" name="UserPhone" value="@entity.UserPhone" readonly type="text" class="form-control">
                        </div>
                    </div>
                </fieldset>
            </div>

            <div class="col-sm-6 m-t">
                <fieldset>
                    <legend>小区信息</legend>

                    <div class="form-group">
                        <label class="col-sm-3 control-label text-center">小区名称：</label>
                        <div class="col-sm-8">
                            <input id="BuildingName" name="BuildingName" value="@entity.BuildingName" readonly type="text" class="form-control">
                        </div>

                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">详细地址：</label>
                        <div class="col-sm-8">
                            <input id="Address" name="Address" value="@entity.Address" readonly type="text" class="form-control">
                        </div>
                    </div>

                    <div class="col-xs-12">

                        <div class="col-xs-5 col-xs-offset-1" style="padding-left: 23px;">
                            <div class="form-group">
                                <label class="col-xs-4 control-label">成交价格：</label>
                                <div class="col-xs-7"><input id="Price" name="Price" value="@entity.Price" readonly type="text" class="form-control"></div>
                            </div>
                        </div>

                        <div class="col-xs-5 col-xs-offset-1" style="padding-right: 28px;">
                            <div class="form-group">
                                <label class="col-xs-4 control-label ">成交面积：</label>
                                <div class="col-xs-7">
                                    <input id="Area" name="Area" value="@entity.Area" readonly type="text" class="form-control">
                                </div>
                            </div>
                        </div>
                    </div>


                </fieldset>

            </div>



            <div class="col-sm-6 m-t">

                <fieldset>
                    <legend>房主信息</legend>
                    <div class="form-group">
                        <label class="col-sm-3 control-label pull-left">房主：</label>
                        <div class="col-sm-8">
                            <input id="HouseOwnerName" name="HouseOwnerName" value="@entity.HouseOwnerName" readonly type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">电话：</label>
                        <div class="col-sm-8 pull-left">
                            <input id="HouseOwnerPhone" name="HouseOwnerPhone" value="@entity.HouseOwnerPhone" readonly type="text" class="form-control">
                        </div>

                    </div>
                </fieldset>
            </div>

            <div class="col-sm-6 m-t">
                <fieldset>
                    <legend>客户信息</legend>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">客户：</label>
                        <div class="col-sm-8">
                            <input id="CustomerName" name="CustomerName" type="text" value="@entity.CustomerName" readonly class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">电话：</label>
                        <div class="col-sm-8">
                            <input id="CustomerPhone" name="CustomerPhone" value="@entity.CustomerPhone" readonly type="text" class="form-control">
                        </div>
                    </div>
                </fieldset>



            </div>

            <div class="col-sm-12 m-t">

                <fieldset>
                    <legend>办件信息</legend>
                    <div class="col-sm-12">

                        @*<div class="col-xs-4">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">资料图片：</label>
                                    <div class="col-sm-9">
                                        @{
                                        List<BaseName>
                                            list = ViewData["images"] as List<BaseName>
                                                ;
                                                if (list.Count > 0)
                                                {
                                                foreach (var item in list)
                                                {
                                                <img src="@item.Name" style="margin-left:6px;" onclick="showImager()" width="36" height="36" />
                                            }
                                        }
                                        else
                                        {
                                            <button id="insertBtn" type="button" class="btn btn-outline btn-primary">
                                                <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                                            </button>
                                        }
                                    }

                                    </div>
                                </div>
                            </div>
                            @{
                            var on = false;
                            DateTime curTime = DateTime.Now;
                            if (entity.Progress == (int)BusinessLoanProgress.审批 || entity.Progress == (int)BusinessLoanProgress.放款 || entity.Progress == (int)BusinessLoanProgress.面签 || (entity.Progress == (int)BusinessLoanProgress.资料收集 && loan.ContractState == 1))
                            {
                            switch (entity.Progress)
                            {
                            case 2:
                            curTime = loan.ContractTime;
                            break;
                            case 3:
                            curTime = loan.ApproveTime;
                            break;
                            case 4:
                            curTime = loan.ProvideTime;
                            break;

                            default:
                            break;
                            }
                            //show();

                            on = true;
                            }
                            else
                            {//hide();
                            on = false;
                            }
                            <div class="col-xs-3" style="@(on?" ":" display:none;")">
                                <div class="form-group">
                                    <label class="col-xs-3 control-label">延时至：</label>

                                    <div class="col-xs-9 form-group">
                                        <input type="text" class="form-control laydate-icon layer-date" id="endDate" name="endDate" readonly="readonly" value="@(exp==null? curTime.ToString(" yyyy-MM-dd"):exp.ExpandTime.ToString("yyyy-MM-dd") )">
                                    </div>

                                </div>
                            </div>

                            }*@

                        @*<div class="col-xs-3" style="@(exp==null?" display:none;":"display:block;") ">
                                <div class="form-group">
                                    <label class="col-xs-3 control-label">延时至：</label>

                                    <div class="col-xs-9 form-group">
                                        <input type="text" class="form-control laydate-icon layer-date" id="endDate" name="endDate" readonly="readonly" value="@(exp==null? DateTime.Now.ToString(" yyyy-MM-01"):"" )">
                                    </div>

                                </div>
                            </div>*@

                        <div class="col-xs-4" id="div_remark" style="display:none;">
                            <div class="form-group">
                                <label class="col-xs-4 control-label">备注：</label>

                                <div class="col-xs-7 form-group">
                                    <textarea type="text" id="Remark" name="Remark" class="col-xs-4 form-control" style="max-width:100%;" rows="1" placeholder="请输入备注信息">@entity.Remark</textarea>
                                </div>
                                <button type="button" class="btn btn-primary btn-outline" onclick="leavingAmessage()">
                                    <i class="glyphicon glyphicon-edit" aria-hidden="true"></i>
                                </button>

                            </div>
                        </div>
                        <div id="initStep" class="col-xs-4" style="display:none;">
                            <div class="form-group">
                                <label class="col-sm-6 control-label">进度初始化：</label>
                                @*<div class="input-group-btn">
                                        <button data-toggle="dropdown" class="btn btn-primary btn-outline dropdown-toggle" type="button" aria-expanded="false">
                                            初始化 <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu wid">
                                            @foreach (int item in Enum.GetValues(typeof(ProgressStr)))
                                            {
                                            if (item <= entity.Progress)
                                            {
                                            <li><a href="javascript:void(0);" onclick="attButton(this,'@item','cName')">@Enum.Parse(typeof(ProgressStr), item.ToString()).ToString()</a></li>
                                            }
                                            }

                                        </ul>
                                    </div>*@
                                <div class="col-sm-6">
                                    <button id="initBtn" type="button" class="btn btn-primary btn-outline">
                                        初始化&nbsp;<i class="glyphicon glyphicon-edit" aria-hidden="true"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>

                </fieldset>
            </div>
        </form>
        <div class="col-sm-12 m-t">
            <fieldset>
                <legend>办件信息--操作</legend>
                <form id="example-form" action="#">
                    <div>
                        <h3>报备审核</h3>
                        <section id="baobei" data-url="/Examples/AsyncContent">
                            <div class="col-xs-10 col-xs-offset-1 ">
                                <div class="col-md-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">送件类型：</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" id="CollectDataType" name="CollectDataType" style="width:300px;">
                                                <option value="0">上门取件</option>
                                                <option value="1">自己送达</option>
                                            </select>
                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">操作：</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" id="Option" name="Option" style="width:300px;">
                                                <option value="2" @(  entity.FilingState == 2 ? "selected" : "" )>同意</option>
                                                <option value="1" @(  entity.FilingState == 3 ? "selected" : "" )>拒绝</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-5">

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">备注：</label>
                                        <div class="col-sm-9">
                                            <textarea type="text" id="FilingAuditingRemark" name="FilingAuditingRemark" class="form-control" rows="3" placeholder="请输入备注信息">@entity.FilingAuditingRemark</textarea>
                                        </div>
                                    </div>
                                </div>

                                <div id="step_0" class="col-md-12" style="margin-top:40px;display:none;">
                                    @if (entity.FilingState == 1)
                                    {
                                        <button id="submit" class="btn btn-primary pull-right" type="button" onclick="clickReq(0,this)">
                                            <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                                        </button>
                                    }

                                </div>
                            </div>
                        </section>
                        <h3>资料搜集</h3>
                        <section id="collect" data-url="/Examples/AsyncContent">
                            <div class="col-xs-10 col-xs-offset-1">

                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">小区名称：</label>
                                        <div class="col-sm-9">
                                            <input type="text" name="BuildingName" class="form-control" placeholder="请输入文本" value="@entity.BuildingName">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">成交面积：</label>
                                        <div class="col-sm-9">
                                            <input type="text" name="Area" class="form-control" placeholder="请输入文本" value="@entity.Area">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">房主姓名：</label>
                                        <div class="col-sm-9">
                                            <input type="text" name="HouseOwnerName" class="form-control" placeholder="请输入文本" value="@entity.HouseOwnerName">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">房主电话：</label>
                                        <div class="col-sm-9">
                                            <input type="text" name="HouseOwnerPhone" class="form-control" placeholder="请输入文本" value="@entity.HouseOwnerPhone">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">房屋地址：</label>
                                        <div class="col-sm-9">
                                            <input type="text" name="Address" class="form-control" placeholder="请输入文本" value="@entity.Address">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">成交价格：</label>
                                        <div class="col-sm-9">
                                            <input type="text" name="Price" class="form-control" placeholder="请输入文本" value="@entity.Price">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">操作：</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" id="CollectDataHandle" name="CollectDataHandle">
                                                <option value="2" @(  entity.CollectDataState == 2 ? "selected" : "" )>完成</option>
                                                <option value="1" @(  entity.CollectDataState == 3 ? "selected" : "" )>终止</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">备注：</label>
                                        <div class="col-sm-9">
                                            <textarea type="text" id="CollectDataRemark" name="CollectDataRemark" class="form-control" rows="1" placeholder="请输入备注信息">@entity.CollectDataRemark</textarea>
                                        </div>
                                    </div>


                                </div>

                                <div id="step_1" class="col-xs-2" style="margin-top:120px;">

                                    @if (entity.CollectDataState == 1)
                                    {
                                        <button id="submit" class="btn btn-primary pull-right" type="button" onclick="clickReq(1, this)">
                                            <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                                        </button>
                                    }

                                </div>
                            </div>

                        </section>
                        <h3>分配办件人</h3>
                        <section>
                            <div class="col-xs-10 col-xs-offset-1">

                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">办件人员：</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" id="TransactStaffID" name="TransactStaffID"></select>
                                        </div>
                                    </div>
                                    @*<div class="form-group">
                                            <label class="col-sm-3 control-label">查档报税时间：</label>
                                            <div class="col-sm-9">
                                                <input type="text" class="form-control layer-date" id="DoTime" name="DoTime" style="cursor:pointer;" value="@loan.QueryArchivesTime">
                                                <label class="laydate-icon inline demoicon" onclick="laydate({ elem: '#DoTime', format: 'YYYY-MM-DD' });"></label>
                                            </div>
                                        </div>*@
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">办件区域：</label>
                                        <div class="col-sm-9">
                                            <input type="text" id="DoArea" name="DoArea" class="form-control" placeholder="请输入文本" value="@loan.Area">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">查档说明：</label>
                                        <div class="col-sm-9">
                                            <textarea type="text" id="QueryArchivesRemark" name="QueryArchivesRemark" class="form-control" style="width:300px;" rows="3" placeholder="请输入备注信息">@loan.QueryArchivesRemark</textarea>
                                        </div>
                                    </div>
                                </div>

                                <div id="step_2"  class="col-md-12" style="margin-top:40px;">
                                    @if (loan.QueryArchivesState == 0 && entity.TransactStaffID == 0)
                                    {
                                        <button id="submit" class="btn btn-primary pull-right" type="button" onclick="clickReq(2, this)">
                                            <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                                        </button>
                                    }

                                </div>
                            </div>


                        </section>
                        <h3>设置查档报税时间</h3>
                        <section>
                            <div class="col-xs-10 col-xs-offset-1">
                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">办理时间：</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control layer-date" id="QueryArchivesTime" name="QueryArchivesTime" value="@loan.QueryArchivesTime.ToString("yyyy-MM-dd")" style="cursor:pointer;">
                                            <label class="laydate-icon inline demoicon" onclick="laydate({ elem: '#QueryArchivesTime', format: 'YYYY-MM-DD' });"></label>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">查档说明：</label>
                                        <div class="col-sm-9">
                                            <textarea type="text" id="QueryArchivesRemark2" name="QueryArchivesRemark2" class="form-control" style="width:280px;" rows="3" placeholder="请输入备注信息">@loan.QueryArchivesRemark</textarea>
                                        </div>
                                    </div>
                                </div>
                                <div id="step_3"  class="col-xs-12" style="margin-top:40px;">


                                    @if (loan.QueryArchivesState == 0 && entity.TransactStaffID != 0 && entity.CollectDataState == 2)
                                    {
                                        <button id="submit" class="btn btn-primary pull-right" type="button" onclick="clickReq(3, this)">
                                            <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                                        </button>

                                    }
                                    else if (entity.Progress == (int)BusinessLoanProgress.资料收集)
                                    {
                                        switch ((int)ViewBag.FinanceDelay)
                                        {
                                            case 1:
                                                <button id="submit" class="btn btn-primary pull-right" type="button" title="面签时间已过期，请重新设置时间" onclick="expTimeTo(this, $('#QueryArchivesTime').val());">
                                                    <i class="fa fa-check"></i>&nbsp;延&nbsp;时
                                                </button>
                                                break;
                                            case 0:
                                                <button id="submit" class="btn btn-primary pull-right" disabled type="button" title="面签时间过期，已申请延时">
                                                    <i class="fa fa-check"></i>延时待审批
                                                </button>
                                                break;
                                        }
                                    }


                                </div>
                            </div>
                            
                        </section>

                        <h3>查档报税</h3>
                        <section>
                            <div class="col-xs-10 col-xs-offset-1">

                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">操作：</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" id="ContractHandle" name="ContractHandle" style="width:280px;">
                                                <option value="2" @(  loan.QueryArchivesState == 2 ? "selected" : "" )>完成</option>
                                                <option value="1" @(  loan.QueryArchivesState == 3 ? "selected" : "" )>终止</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">面签说明：</label>
                                        <div class="col-sm-9 m-b">
                                            <textarea type="text" id="ContractRemark2" name="ContractRemark2" class="form-control" style="width:300px;" rows="2" placeholder="请输入备注信息">@loan.QueryArchivesRemark</textarea>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">资料图片：</label>
                                        <div class="col-sm-9">

                                            @{
                                                List<BaseName> list = imgList.Where(x => x.Id == 1).ToList();
                                                if (list.Count() > 0)
                                                {
                                                    for (int i = 0; i < list.Count(); i++)
                                                    {
                                                        var item = list[i];
                                                        if (i == 0)
                                                        {
                                                            <img src="@item.Name" onclick="showImager(1)" width="36" height="36" />
                                                        }
                                                        else
                                                        {
                                                            <img src="@item.Name" style="margin-left:6px;" onclick="showImager(1)" width="36" height="36" />
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    <button id="insertBtn" type="button" class="btn btn-outline btn-primary" onclick="showImager(1)">
                                                        <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                                                    </button>
                                                }
                                            }


                                            @*<button id="insertBtn" type="button" class="btn btn-outline btn-primary" onclick="showImager(1)">
                                                    <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                                                </button>*@

                                        </div>
                                    </div>

                                </div>
                                <div class="col-xs-6">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">过户时间：</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control layer-date" id="TransferTime" name="TransferTime" value="@loan.TransferTime.ToString("yyyy-MM-dd")" style="cursor:pointer;">
                                            <label class="laydate-icon inline demoicon" onclick="laydate({ elem: '#TransferTime', format: 'YYYY-MM-DD' });"></label>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">过户说明：</label>
                                        <div class="col-sm-9">
                                            <textarea type="text" id="TransferRemark" name="TransferRemark" class="form-control" style="width:280px;" rows="3" placeholder="请输入备注信息">@loan.TransferRemark</textarea>
                                        </div>
                                    </div>
                                </div>

                                <div id="step_4" class="col-xs-2" style="margin-top:120px;">
                                    @if (loan.QueryArchivesState == 1)
                                    {
                                        <button id="submit" class="btn btn-primary pull-right" type="button" onclick="clickReq(4, this)">
                                            <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                                        </button>
                                    }
                                    else if (entity.Progress == (int)BusinessLoanProgress.面签)
                                    {
                                        switch ((int)ViewBag.FinanceDelay)
                                        {
                                            case 1:
                                                <button id="submit" class="btn btn-primary pull-right" type="button" title="审批时间已过期，请重新设置时间" onclick="expTimeTo(this, $('#TransferTime').val());">
                                                    <i class="fa fa-check"></i>&nbsp;延&nbsp;时
                                                </button>
                                                break;
                                            case 0:
                                                <button id="submit" class="btn btn-primary pull-right" disabled type="button" title="审批时间过期，已申请延时">
                                                    <i class="fa fa-check"></i>延时待审批
                                                </button>
                                                break;
                                        }
                                    }

                                </div>
                            </div>

                        </section>
                        <h3>过户</h3>
                        <section>
                            <div class="col-xs-10 col-xs-offset-1">
                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">操作：</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" id="ApproveHandle" name="ApproveHandle" style="width:280px;">
                                                <option value="2" @(  loan.TransferState == 2 ? "selected" : "" )>完成</option>
                                                <option value="1" @(  loan.TransferState == 3 ? "selected" : "" )>终止</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">审批说明：</label>
                                        <div class="col-sm-9 m-b">
                                            <textarea type="text" id="ApproveRemark2" name="ApproveRemark2" class="form-control" style="width:300px;" rows="2" placeholder="请输入备注信息">@loan.TransferRemark</textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">资料图片：</label>
                                        <div class="col-sm-9">

                                            @{
                                                List<BaseName> list2 = imgList.Where(x => x.Id == 2).ToList();
                                                if (list2.Count() > 0)
                                                {
                                                    for (int i = 0; i < list2.Count(); i++)
                                                    {
                                                        var item = list2[i];
                                                        if (i == 0)
                                                        {
                                                            <img src="@item.Name" onclick="showImager(2)" width="36" height="36" />
                                                        }
                                                        else
                                                        {
                                                            <img src="@item.Name" style="margin-left:6px;" onclick="showImager(2)" width="36" height="36" />
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    <button id="insertBtn" type="button" class="btn btn-outline btn-primary" onclick="showImager(2)">
                                                        <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                                                    </button>
                                                }
                                            }
                                            @*<button id="insertBtn" type="button" class="btn btn-outline btn-primary">
                                                    <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                                                </button>*@

                                        </div>
                                    </div>
                                </div>

                                <div class="col-xs-6">

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">下证时间：</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control layer-date" id="CredentialsTime" name="CredentialsTime" value="@loan.CredentialsTime.ToString("yyyy-MM-dd")" style="cursor:pointer;">
                                            <label class="laydate-icon inline demoicon" onclick="laydate({ elem: '#CredentialsTime', format: 'YYYY-MM-DD' });"></label>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">下证说明：</label>
                                        <div class="col-sm-9">
                                            <textarea type="text" id="CredentialsRemark" name="CredentialsRemark" class="form-control" style="width:280px;" rows="3" placeholder="请输入备注信息">@loan.CredentialsRemark</textarea>
                                        </div>
                                    </div>
                                </div>

                                <div id="step_5" class="col-xs-2" style="margin-top:120px;">
                                    @if (loan.TransferState == 1)
                                    {
                                        <button id="submit" class="btn btn-primary pull-right" type="button" onclick="clickReq(5, this)">
                                            <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                                        </button>
                                    }
                                    else if (entity.Progress == (int)BusinessLoanProgress.审批)
                                    {
                                        switch ((int)ViewBag.FinanceDelay)
                                        {
                                            case 1:
                                                <button id="submit" class="btn btn-primary pull-right" type="button" title="审批时间已过期，请重新设置时间" onclick="expTimeTo(this, $('#CredentialsTime').val());">
                                                    <i class="fa fa-check"></i>&nbsp;延&nbsp;时
                                                </button>
                                                break;
                                            case 0:
                                                <button id="submit" class="btn btn-primary pull-right" disabled type="button" title="审批时间过期，已申请延时">
                                                    <i class="fa fa-check"></i>延时待审批
                                                </button>
                                                break;
                                        }
                                    }

                                </div>
                            </div>


                        </section>

                        <h3>下证</h3>
                        <section>
                            <div class="col-xs-10 col-xs-offset-1">


                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">操作：</label>
                                        <div class="col-sm-9">
                                            <select class="form-control" id="ProvideHandle" name="ProvideHandle" style="width:280px;">
                                                <option value="2" @(  loan.CredentialsState == 2 ? "selected" : "" )>完成</option>
                                                <option value="1" @(  loan.CredentialsState == 3 ? "selected" : "" )>终止</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">资料图片：</label>
                                        <div class="col-sm-9">
                                            @{
                                                List<BaseName> list3 = imgList.Where(x => x.Id == 3).ToList();
                                                if (list3.Count() > 0)
                                                {
                                                    for (int i = 0; i < list3.Count(); i++)
                                                    {
                                                        var item = list3[i];
                                                        if (i == 0)
                                                        {
                                                            <img src="@item.Name" onclick="showImager(3)" width="36" height="36" />
                                                        }
                                                        else
                                                        {
                                                            <img src="@item.Name" style="margin-left:6px;" onclick="showImager(3)" width="36" height="36" />
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    <button id="insertBtn" type="button" class="btn btn-outline btn-primary" onclick="showImager(3)">
                                                        <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                                                    </button>
                                                }
                                            }
                                            @*<button id="insertBtn" type="button" class="btn btn-outline btn-primary">
                                                    <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                                                </button>*@

                                        </div>
                                    </div>

                                </div>
                                <div class="col-xs-5">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">下证说明：</label>
                                        <div class="col-sm-9">
                                            <textarea type="text" id="CredentialsRemark2" name="CredentialsRemark2" class="form-control" style="width:280px;" rows="3" placeholder="请输入备注信息">@loan.CredentialsRemark</textarea>
                                        </div>
                                    </div>


                                </div>
                                <div id="step_6" class="col-xs-2" style="margin-top:120px;">
                                    @if (loan.CredentialsState == 1)
                                    {
                                        <button id="submit" class="btn btn-primary pull-right" type="button" onclick="clickReq(6, this)">
                                            <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                                        </button>
                                    }
                                </div>
                            </div>
                        </section>

                    </div>
                </form>

            </fieldset>
        </div>


    </div>
    <input type="hidden" id="RunningId" name="RunningId" value="@entity.Id" />
    <input type="hidden" id="StepIdx" name="StepIdx" value="@ViewBag.StepIdx" />
    <input type="hidden" id="ImageCount" name="ImageCount" value="@ViewBag.ImageCount" />
    <input type="hidden" id="Image1" name="Image1" value="@(imgList.Where(x=>x.Id==1).Count())" />
    <input type="hidden" id="Image2" name="Image2" value="@(imgList.Where(x=>x.Id==2).Count())" />
    <input type="hidden" id="Image3" name="Image3" value="@(imgList.Where(x=>x.Id==3).Count())" />
    <input type="hidden" id="H_Progress" name="H_Progress" value="@entity.Progress" />
    <input type="hidden" id="H_TransactStaffID" name="H_TransactStaffID" value="@entity.TransactStaffID" />

    <!-- 全局js -->
    <script type="text/javascript" src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="~/Scripts/bootstrap.min.js?v=3.3.6"></script>

    <!-- jQuery Validation plugin javascript-->
    <script type="text/javascript" src="~/Scripts/plugins/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript" src="~/Scripts/Extensions/ExtValidator.js?a=@(DateTime.Now.Millisecond)"></script>

    <!-- layer javascript -->
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>
    <script src="~/Scripts/plugins/layer/laydate/laydate.js"></script>
    <!-- Steps -->
    <script src="~/Scripts/plugins/staps/jquery.steps-1.1.0.js?a=@(DateTime.Now.Millisecond)"></script>
    <script src="~/Scripts/loginmodel.js"></script>
    <!-- Jquery Validate -->

    <script>
        //laydate({
        //    elem: '#endDate',
        //    start: laydate.now(),
        //    format: 'YYYY-MM-DD', // 分隔符可以任意定义，该例子表示只显示年月
        //    festival: true, //显示节日
        //    //max: laydate.now(), //设定最小日期为当前日期
        //    max: laydate.now(+(90), "YYYY-MM-DD HH:00:00"),
        //    min: '2016-01-01 00:00:00', //最大日期
        //    choose: function (datas) { //选择日期完毕的回调
        //        console.log(datas);
        //        //expTimeTo(datas);
        //        //alert('得到：' + datas);
        //    }
        //});
        function expTimeTo(self, ttime) {

            var obj = { time: ttime };// $('#ContractTime').val()
            //进行ajax传值
            $.ajax({
                url: "/Transfer/EditAsync4ExpTime",
                type: "post",
                dataType: "json",
                data: { id: $("#RunningId").val(), curIdx: $("#H_Progress").val(), str: JSON.stringify(obj) },
                success: function (data) {
                    //Info,Success,Warning,Error
                    var type = data.type;
                    //console.log(Number(svcIdx) + 1); console.log(data);
                    if (type == 1) {

                        layer.msg(data.content, { icon: 6, time: 2000 },
                            function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                                $(self).addClass("disabled");
                            });

                    } else {
                        layer.msg(data.content, { icon: 5, time: 2000 });
                        window.location.reload();
                    }
                }
            });
        }

    </script>
    <script>
        $(function () {
            // 
            if (isAuthority('297')) {
                $('#div_remark').attr('style', "display:block;");
            }
            if (isAuthority('298')) {
                $('#step_0').attr('style', "margin-top:40px;display:block;");
            }
            if (isAuthority('300')) {
                $('#step_1').attr('style', "margin-top:120px;display:block;");
            }
            if (isAuthority('301')) {
                $('#step_2').attr('style', "margin-top:40px;display:block;");
            }
            if (isAuthority('310')) {
                $('#step_3').attr('style', "margin-top:40px;display:block;");
            }
            if (isAuthority('311')) {
                $('#step_4').attr('style', "margin-top:120px;display:block;");
            }
            if (isAuthority('312')) {
                $('#step_5').attr('style', "margin-top:120px;display:block;");
            }
            if (isAuthority('313')) {
                $('#step_6').attr('style', "margin-top:120px;display:block;");
            }
            if (isAuthority('315')) {
                $('#initStep').attr('style', "display:block;");
            }

            //插入按钮
            //$('#insertBtn').click(showImager);
            //$('#searchBtn').click(showImager);

            var form = $("#example-form");
            form.validate({
                errorPlacement: function errorPlacement(error, element) { element.before(error); },
                rules: {
                    confirm: {
                        equalTo: "#password"
                    }
                }
            });
            var idx = (Number($("#StepIdx").val()));
            if (form.children("div").find("h3").length == idx) {
                idx = idx - 1;
                console.log($("a[href='#finish']").parent().html());
            }
            form.children("div").steps({
                headerTag: "h3",
                bodyTag: "section",
                //transitionEffect: "slideLeft",
                //enableAllSteps: true,
                //enablePagination: false,

                transitionEffect: "fade",
                enableFinishButton: false,
                enablePagination: false,
                enableAllSteps: false,
                //titleTemplate: "#title#",
                //cssClass: "tabcontrol",

                startIndex: idx,
                onStepChanging: function (event, currentIndex, newIndex) {//处理验证信息
                    console.log(currentIndex);
                    form.validate().settings.ignore = ":disabled,:hidden";

                    if (currentIndex > newIndex) {
                        //console.log(currentIndex + "上一步2" + newIndex);
                    } else {
                        //console.log(idx + "下一步2" + currentIndex);                                               

                    }

                    return form.valid();
                }, onStepChanged: function (event, currentIndex, priorIndex) {//跳转到下一页后

                    if (Number(currentIndex) < Number(priorIndex)) {//
                        //console.log(idx + "上一步" + currentIndex);
                    } else {//
                        //console.log(idx + "下一步" + currentIndex);
                    }

                    //console.log(Number($("#age-2").val()) + "-----------");
                    //// Used to skip the "Warning" step if the user is old enough.
                    //if (currentIndex === 2 && Number($("#age-2").val()) >= 18) {
                    //    form.steps("next");
                    //}
                    //// Used to skip the "Warning" step if the user is old enough and wants to the previous step.
                    //if (currentIndex === 2 && priorIndex === 3) {
                    //    form.steps("previous");
                    //}
                },
                onFinishing: function (event, currentIndex) {
                    form.validate().settings.ignore = ":disabled";
                    return form.valid();
                },
                onFinished: function (event, currentIndex) {
                    if ($("a[href='#finish']").parent().attr("class") == "disabled") return;
                    reqAlter($("#RunningId").val(), currentIndex, idx);
                }
            });

            if (form.children("div").find("h3").length == (idx + 1)) {
                $("a[href='#finish']").parent().addClass('disabled');
            }
            $('#initBtn').click(function () {
                $.ajax({
                    url: "/Transfer/ApprovalAsync",
                    type: "post",
                    dataType: "json",
                    data: { id: $("#RunningId").val() },
                    success: function (data) {
                        //Info,Success,Warning,Error
                        var type = data.type;
                        if (type == 1) {

                            layer.msg(data.content, { icon: 6, time: 2000 },
                                function () {
                                    var index = parent.layer.getFrameIndex(window.name);
                                    parent.layer.close(index);
                                    window.location.reload();
                                });

                        } else {
                            layer.msg(data.content, { icon: 5, time: 2000 });
                        }
                    }
                });
            });
            getUser();
        });
        function clickReq(index, self) {

            if (index == 4 && $('#ContractHandle').val() != 1 && Number($('#Image1').val()) <= 0) {
                layer.msg("请上传资料图片", { icon: 5, time: 2000 });
                return;
            }
            if (index == 5 && $('#ApproveHandle').val() != 1 && Number($('#Image2').val()) <= 0) {
                layer.msg("请上传资料图片", { icon: 5, time: 2000 });
                return;
            }
            if (index == 6 && $('#ApproveHandle').val() != 1 && Number($('#Image3').val()) <= 0) {
                layer.msg("请上传资料图片", { icon: 5, time: 2000 });
                return;
            }
            var idx = (Number($("#StepIdx").val()));
            $(self).addClass("disabled");
            reqAlter($("#RunningId").val(), index, idx);
        }

        function reqAlter(key, index, svcIdx) {
            console.log("key===" + key);
            var search = $('#example-form').serialize().replace(/\+/g, " ");
            var cc = JSON.parse('{"' + search.replace(/&/g, '","').replace(/=/g, '":"') + '"}', function (key, value) { return key === "" ? value : decodeURIComponent(value) });
            //进行ajax传值
            $.ajax({
                url: "/Transfer/EditAsync",
                type: "post",
                dataType: "json",
                data: { id: key, curIdx: index, str: JSON.stringify(cc) },
                success: function (data) {
                    //Info,Success,Warning,Error
                    var type = data.type;
                    console.log(Number(svcIdx) + 1); console.log(data);
                    if (type == 1) {

                        layer.msg(data.content, { icon: 6, time: 2000 },
                            function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);

                                console.log($('.edit').html());
                                window.location.href = $(".edit").attr("href");
                            });

                    } else {
                        layer.msg(data.content, { icon: 5, time: 2000 });
                        window.location.reload();
                    }
                }
            });
        }
        function getUser() {
            var _tar = $('#H_TransactStaffID').val();
            //进行ajax传值
            $.ajax({
                url: "/Running/GetUserAsync",
                type: "post",
                dataType: "json",
                //data: { id: key, curIdx: index, str: JSON.stringify(cc) },
                success: function (data) {
                    //Info,Success,Warning,Error
                    var type = data.type;
                    if (type == 1) {

                        $("#TransactStaffID").empty();
                        $.each(data.data, function (val, obj) {
                            //console.log(_tar + "==" + obj.name);
                            $('<option value="' + obj.id + '" ' + (_tar == obj.id ? "selected" : "") + '>' + obj.name + '</option>').appendTo($("#TransactStaffID"));
                        });

                    } else {
                        //layer.msg(data.content, { icon: 5, time: 2000 });
                    }
                }
            })
        }

        function showImager(type) {
            parent.layer.open({
                type: 2,
                title: '添加图片',
                shadeClose: false,
                shade: 0.4,
                area: ['960px', '750px'],
                content: '/Images/Index?GroupID=' + 9 + '&InterfixID=' + $('#RunningId').val() + '&ImageType=' + type,
                end: function () {
                    //refreshTable();
                    window.location.reload();
                }
            });
        }

        function leavingAmessage() {
            $.ajax({
                url: "/Running/EditAsyncBy",
                type: "post",
                //dataType: "json",
                data: { Id: $("#RunningId").val(), Remark: $('#Remark').val(), Progress: 1 },//, str: JSON.stringify(cc)
                success: function (data) {
                    //Info,Success,Warning,Error
                    var type = data.type;
                    if (type == 1) {

                        layer.msg(data.content, { icon: 6, time: 2000 });

                    } else {
                        layer.msg(data.content, { icon: 5, time: 2000 });
                    }
                }
            })
            //parent.layer.open({
            //    type: 2,
            //    title: '转交明细',
            //    shadeClose: false,
            //    shade: 0.4,
            //    area: ['400px', '300px'],
            //    content: '/Finance/Running/Edit?id=' + $('#RunningId').val(),
            //    end: function () {
            //        //refreshTable();
            //        //window.location.reload();
            //    }
            //});
        }
    </script>

</body>
</html>
